#include <func.h>

void handle(int signaler)
{
    switch(signaler)
    {
        case SIGINT:
            printf("Caught SIGINT\n");
            break;
        case SIGQUIT:
            printf("Caught SIGQUIT\n");
            break;
        case SIGTSTP:
            printf("Caught SIGTSTP\n");
    }

}

int main(int argc,char* argv[])
{
    sighandler_t oldhander = signal(SIGINT,handle);
    if(oldhander == SIG_ERR)
        error(1,errno,"SIGINT");

    oldhander = signal(SIGQUIT,handle);
    if(oldhander == SIG_ERR)
        error(1,errno,"STGQUIT");

    oldhander = signal(SIGTSTP,handle);
    if(oldhander == SIG_ERR)
        error(1,errno,"SIGTSTP");

    for(;;)
        sleep(5);

    return 0;
}
